<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="GB18030">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet"
	href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/static/css/font-awesome.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/static/css/main.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/static/ztree/zTreeStyle.css">
</head>
<body style="margin-top: -50px">
	<div class="panel panel-default" style="margin-top: 0px; width: 700px;">
		<div class="panel-heading">
			<h3 class="panel-title">
				<i class="glyphicon glyphicon-th"></i> 修改密码
			</h3>
		</div>
		<div class="panel-body">
			<form id="form1">
				<input type="text" value="${sessionScope.login_user.userName}" name="userName" hidden/>
				<div class="form-group">
					<label for="inputoldPassword">原密码</label> <input type="password"
						class="form-control" id="inputoldPassword" name="oldPassword"
						placeholder="请输入原密码" required="required">
				</div>
				<div class="form-group">
					<label for="inputnewPassword">新密码</label> <input type="password"
						class="form-control" id="inputnewPassword" name="newPassword"
						placeholder="请输入新密码" required="required">
				</div>
				<div class="form-group">
					<label for="inputnewPassword2">确认新密码</label> <input type="password"
						class="form-control" id="inputnewPassword2" placeholder="请再次输入新密码"
						required="required">
				</div>
				<div id="div1" style="color: red;"></div>

				<button type="button" class="btn btn-success" id="sub1">
					<i class="glyphicon glyphicon-ok"></i> 保存
				</button>
				<button type="reset" class="btn btn-danger">
					<i class="glyphicon glyphicon-refresh"></i> 重置
				</button>
			</form>

		</div>
	</div>
	<script
		src="${pageContext.request.contextPath}/static/jquery/jquery-2.1.1.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/static/bootstrap/js/bootstrap.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/static/script/docs.min.js"></script>
		<script type="text/javascript">
		$(function(){
			$("#sub1").click(function(){
				
				if ($("#inputnewPassword").val()!=$("#inputnewPassword2").val()) {
					$("#div1").html("密码输入不一致");
				}else{
					$("#div1").html("");
					$.getJSON("${pageContext.request.contextPath}/user/updatePassword",$("#form1").serialize(),function(data){
						alert(data);
						$("#form1")[0].reset();
					})
				}
			})
		})
		
		
		</script>
</body>
</html>